package com.ppt.toolbar;

import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.persistence.Entity;
import javax.persistence.OneToOne;
import javax.swing.JButton;
import javax.swing.JToolBar;

import com.ppt.frame.MainFrame;

@Entity
public class ToolBar extends JToolBar implements ActionListener {

	private static final long serialVersionUID = 1L;

	public JButton btnPrint, btnMail, btnOptions, btnAvg, btnHelp, btnExit, btnRTOn, btnRTOff;
	@OneToOne()
	private MainFrame base;

	protected ToolBar() {
	}

	public ToolBar(MainFrame base) {
		this.base = base;
		initializeGUI();
		addListeners();
	}

	private void initializeGUI() {

		setBorderPainted(false);
		setRollover(true);
		setBorder(null);
		setFloatable(false);

		btnPrint = new JButton();
		btnPrint.setEnabled(false);
		btnPrint.setPreferredSize(new Dimension(38, 40));
		this.add(btnPrint);

		btnMail = new JButton();
		btnMail.setEnabled(false);
		btnMail.setPreferredSize(new Dimension(38, 40));
		this.add(btnMail);

		btnOptions = new JButton();
		btnOptions.setEnabled(false);
		btnOptions.setPreferredSize(new Dimension(38, 40));
		this.add(btnOptions);

		btnAvg = new JButton();
		btnAvg.setPreferredSize(new Dimension(38, 40));
		this.add(btnAvg);

		btnHelp = new JButton();
		btnHelp.setPreferredSize(new Dimension(38, 40));
		this.add(btnHelp);

		this.add(new JToolBar.Separator());


		btnExit = new JButton();
		btnExit.setEnabled(true);
		btnExit.setPreferredSize(new Dimension(38, 40));

		this.add(new JToolBar.Separator());
		this.add(btnExit);

	}

	private void addListeners() {
		btnPrint.addActionListener(this);
		btnMail.addActionListener(this);
		btnOptions.addActionListener(this);
		btnAvg.addActionListener(this);
		btnHelp.addActionListener(this);
		btnExit.addActionListener(this);
	}

	public void actionPerformed(ActionEvent e) {

		if (e.getSource() == btnPrint) {

		} else if (e.getSource() == btnExit) {
			System.exit(1);

		} else if (e.getSource() == btnMail) {
		} else if (e.getSource() == btnOptions) {
		} else if (e.getSource() == btnHelp) {
		}

	}
}

